package com.builder;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

import com.model.Remito;
import com.view.RemitoView;

@SuppressWarnings("serial")
@ManagedBean
@ViewScoped
public class RemitoBuilder extends BaseBuilder<RemitoView, Remito> {

	@ManagedProperty("#{remitoDetalleBuilder}")
	private RemitoDetalleBuilder remitoDetalleBuilder;

	@ManagedProperty("#{proveedorBuilder}")
	private ProveedorBuilder proveedorBuilder;

	@ManagedProperty("#{ordenDeCompraDetalleBuilder}")
	private OrdenDeCompraDetalleBuilder ordenDeCompraDetalleBuilder;

	public Remito toDomain(RemitoView view) {
		return new Remito(view.getId(), view.getFechaRemito(),
				view.getNumeroRemito(), remitoDetalleBuilder.toDomain(view
						.getDetalleRemitoView()), view.getEstado(),
				view.getFechaRecepcion());
	}

	public RemitoView toView(Remito model) {
		return new RemitoView(model.getID(), model.getFechaRemito(),
				model.getNumeroRemito(), remitoDetalleBuilder.toView(model
						.getDetalleRemito()), model.getEstado(),
				model.getFechaRecepcion());
	}

	public RemitoDetalleBuilder getRemitoDetalleBuilder() {
		return remitoDetalleBuilder;
	}

	public void setRemitoDetalleBuilder(
			RemitoDetalleBuilder remitoDetalleBuilder) {
		this.remitoDetalleBuilder = remitoDetalleBuilder;
	}

	public ProveedorBuilder getProveedorBuilder() {
		return proveedorBuilder;
	}

	public void setProveedorBuilder(ProveedorBuilder proveedorBuilder) {
		this.proveedorBuilder = proveedorBuilder;
	}

	public OrdenDeCompraDetalleBuilder getOrdenDeCompraDetalleBuilder() {
		return ordenDeCompraDetalleBuilder;
	}

	public void setOrdenDeCompraDetalleBuilder(
			OrdenDeCompraDetalleBuilder ordenDeCompraDetalleBuilder) {
		this.ordenDeCompraDetalleBuilder = ordenDeCompraDetalleBuilder;
	}

}
